using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework.Net;

namespace Xyne.Network
{
    /// <summary>
    /// Network data that is the game state.
    /// </summary>
    public class GameStateData : NetworkData
    {
        List<StateEntity> entities;

        public GameStateData(List<StateEntity> entities)
        {
            DataType = NetworkDataType.GameState;

            this.entities = entities;
        }

        public override void Serialize(PacketWriter writer)
        {
            writer.Write(entities.Count);

            foreach (StateEntity entity in entities)
            {
                writer.Write((ulong)entity.EntityType);
                entity.GetState(writer);
            }
        }
    }
}
